package grpc

import (
	"context"
	"go-rpc-2/grpc/gen"
)

type UserService struct {
	Count int64
	gen.UnimplementedUserServiceServer
}

func (u *UserService) GetUserById(ctx context.Context, request *gen.GetUserByIdRequest) (*gen.GetUserByIdResponse, error) {
	id := request.Id
	res := &gen.GetUserByIdResponse{}

	// mock 找到的user
	us := &gen.User{Id: id, Name: "zly", Username: "zly2", Email: "123", Age: u.Count}

	res.Data = us
	return res, nil
}
